﻿Partial Public Class EgresadoInfoAcademica
    Inherits System.Web.UI.Page

    Dim ocnEgresados As New CapaNegocio.Egresados
    Dim ocnInstituciones As New CapaNegocio.Insituciones
    Dim ocnAlumnos As New CapaNegocio.Alumnos

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        cargargrilla()
    End Sub


    Function cargarListaInstituciones()
        Dim ds As New DataSet
        ds = ocnInstituciones.obtenerListaInstituciones()
        'AutoPostBack = true

        With Me.DropDownListInstitucion
            .DataSource = ds.Tables("ListaInstituciones").DefaultView
            .DataTextField = "nombreInstitucion"
            .DataValueField = "nombreInstitucion"
        End With
        Me.DropDownListInstitucion.DataBind()

        Return Me.DropDownListInstitucion

    End Function

    Function cargargrilla()
        Dim ds As New DataSet
        ds = ocnAlumnos.obtenerVistaAlumnoInfoAcademica()

        Me.GridViewAlumnoInfoAcademica.DataSource = ds.Tables(0)

        Me.GridViewAlumnoInfoAcademica.DataBind()
        Return Me.GridViewAlumnoInfoAcademica
    End Function

    Protected Sub ButtonGuardar_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ButtonGuardar.Click

        ocnAlumnos.InsertarInfoAcademica(Me.TextBoxDniAlumno1.Text _
                                           , Me.DropDownListInstitucion.SelectedItem.Text _
                                           , Me.TextBoxTituloPosgrado.Text _
                                           , Me.CalendarAño.Text)
        cargargrilla()
        cargarListaInstituciones()
    End Sub

    Private Sub DropDownListInstitucion_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownListInstitucion.Init
        cargarListaInstituciones()
    End Sub


End Class